﻿--[[
   @brief    plugin_tool_simple_panel
   @author   hqzheng, harleyxwang
   @version  1.0
   @date     2016-10-08
--]]

CloudGameState = {
        kCloudGameStateReady = 0;
        kCloudGameStateNeedUpdate = 1;
        kCloudGameStateUpdating = 2;
        kCloudGameStateLaunching = 3;
        kCloudGameStateRunning = 4;
        kCloudGameStateServerUnavailable = 5;
        kCloudGameStateUpdateFailed = 9;
        kCloudGameStateLaunchFailed = 10;
    };

plugin_tool_simple_panel = {
    
    parent_id = 0;
    color_mode_ = MainCommon.color_mode.kDark;
    cur_game_id = 0;
    cur_channel_id = 0;
    dlc_download_tips = {};
    show_dlc_btn_flag = false;

    load_content_count = 0;
    MAX_LOAD_CONTENT_COUNT = 3;

    cloud_game_entry_status = {
        visible = false,
        can_start = false,
        show_txt = "",
    };

    cloud_game_btn_tips_text = "";
    cloud_game_maintenance_tips = "";
    cloud_game_oss_cfg = nil;
    cloud_game_is_running = false;
    cloud_game_zone_id = 0;
    cloud_gaming_server_closed = false;
    inited = false;
    cur_game_state = nil;

    init = function (parent_id, game_id, game_type)
        ierd_tgp.tpf_ui.Require("frame_bottom\\dlc_mgr_view.lua");
        
        if game_id == plugin_tool_simple_panel.cur_game_id then
            return;
        end
        comm_center.listen_broadcast("i_broadcast_mainframe_pos_change", plugin_tool_simple_panel.on_mainframe_position_change);
        comm_center.listen_broadcast("i_broadcast_mainframe_size_change", plugin_tool_simple_panel.on_mainframe_size_change);
        plugin_tool_simple_panel.parent_id = parent_id;
        plugin_tool_simple_panel.cur_game_id = game_id;
        local parent_ptr = ui_utility.get_ctrl_ptr_by_id(parent_id);
        if nil ~= parent_ptr then
            -- step1: 卸载之前的布局
            parent_ptr:UnLoadContent();
            plugin_tool_simple_panel.load_content_count = 0;
            -- step2：加载新的布局
            ui_utility.setproperty_by_id(parent_id, 'Content', "PluginToolSimplePanel.tpf");
            -- step3： 异步进行加载
            local param = {};
            param["game_id"] = game_id;
            param["game_type"] = game_type;
            local json = base_utility.table_to_json(param);
            event_center.post_event(frame_bottom_event.CHANGE_GAME_PLUGIN_SIMPLE_PANEL, json, true);
        end
        --查询云游戏权限
        if base_utility.CLIENT_TYPE.OVERSEA_VER ~= base_utility.get_client_version_type() then
            if plugin_tool_simple_panel.inited == false then
                comm_center.listen_broadcast("Svr_CloudGameState", 
                    plugin_tool_simple_panel.change_cloud_game_state);
                comm_center.listen_broadcast("i_broadcast_cloud_game_cfg_info", 
                    plugin_tool_simple_panel.show_cloud_game_btn);
            end;
        end;
        plugin_tool_simple_panel.reset_cloud_game_entry_status();

        plugin_tool_simple_panel.inited = true;
        comm_center.listen_broadcast("MsgTGPConfigMgr_UpdateClientMode",
                                     "plugin_tool_simple_panel.on_color_mode_update");
    end;

    reset_game_id = function()
        plugin_tool_simple_panel.cur_game_id = 0;
    end;

    reset_cloud_game_entry_status = function()
        plugin_tool_simple_panel.cloud_game_entry_status.visible = false;
        plugin_tool_simple_panel.cloud_game_entry_status.can_start = false;
        plugin_tool_simple_panel.cloud_game_entry_status.show_txt = "";
    end;

    set_cloud_game_entry_status = function(visible, can_start, show_txt)
        plugin_tool_simple_panel.cloud_game_entry_status.visible = visible;
        plugin_tool_simple_panel.cloud_game_entry_status.can_start = can_start;
        plugin_tool_simple_panel.cloud_game_entry_status.show_txt = show_txt;
        
        comm_center.call_service("i_service_refresh_operate_menu", {});
    end;

    get_cloud_game_entry_status = function()
        return plugin_tool_simple_panel.cloud_game_entry_status;
    end;

    -- 切换助手面板
    change_plugin_simple_panel = function (event_id, json_str)
        base_utility.log("change_plugin_panel");
        rail_dlc_manager_view.close();
        local param = base_utility.json_to_table(json_str);
        if param == nil then
            base_utility.log("[change_plugin_panel] bad json param");
            return;
        end

        if param.game_id ~= plugin_tool_simple_panel.cur_game_id then
            return;
        end
        if plugin_tool_simple_panel.load_content_count > 
            plugin_tool_simple_panel.MAX_LOAD_CONTENT_COUNT then
            base_utility.log(string.format(
                "[frame_bottom][change_plugin_panel] load content reach 3 count, game_id:%d",
                plugin_tool_simple_panel.cur_game_id));
            return;
        end
        local parent_ptr = ui_utility.get_ctrl_ptr_by_id(plugin_tool_simple_panel.parent_id);

        if nil ~= parent_ptr then
            local result = parent_ptr:LoadContent();
            base_utility.log(string.format(
                "[frame_bottom]change_plugin_panel,loadcontent result:%s", tostring(result)));
            
            plugin_tool_simple_panel.load_content_count = plugin_tool_simple_panel.load_content_count + 1;
            
            if FALSE == result then
                -- 如果布局加载失败，则进行重新加载
                local param_event = {};
                param_event["game_id"] = plugin_tool_simple_panel.cur_game_id;
                param_event["game_type"] = param.game_type;
                local json = base_utility.table_to_json(param_event);
                event_center.post_event(
                    frame_bottom_event.CHANGE_GAME_PLUGIN_SIMPLE_PANEL, json, true);
                base_utility.log("[frame_bottom]change_plugin_panel, post event again!");
                return;
            end
        end

        local stand_alone_game_ctn_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn");
        local custom_ctn_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\CustomGameCtn"); -- 增加自定义按钮区域，针对没有助手的游戏
        
        if frame_bottom_model.GAME_TYPE.STANDALONG_GAME == param.game_type then
            ui_utility.set_visible(stand_alone_game_ctn_id, true);
            ui_utility.set_visible(custom_ctn_id, false);
            -- 预下载按钮
            plugin_tool_simple_panel.set_preupdate_btn_state();
        --[[
        elseif frame_bottom_model.is_super_multi_account(game_id) then -- fixme
            ui_utility.set_visible(stand_alone_game_ctn_id, false);
            ui_utility.set_visible(custom_ctn_id, true);
        ]]
        end

        ui_utility.setproperty_by_path(stand_alone_game_ctn_id, "BtnCrossSetting", "Visible", "true");
        -- 设置版本公告
        plugin_tool_simple_panel.set_version_post_state();

        -- 设置高清区入口
        plugin_tool_simple_panel.set_attach_game_entry_state(plugin_tool_simple_panel.cur_game_id);

        plugin_tool_simple_panel.set_download_extension_btn_state();

        comm_center.call_service('i_service_check_cloud_game_cfg', 
            {game_id = plugin_tool_simple_panel.cur_game_id});

        local color_data_config = comm_center.call_service("SvrTGPConfigMgr_GetColorMode", {});
        if color_data_config ~= nil and color_data_config.color_mode ~=nil then
            local color_data_param = {color_mode = color_data_config.color_mode };
            plugin_tool_simple_panel.on_color_mode_update(color_data_param);
        end;
    end;

    on_subaccount_btn_click = function (uilib, control_id, x, y)
        local param = {};
        local data = {};
        data["game_id"] = plugin_tool_simple_panel.cur_game_id;
        param["data"] = data;

        local json = base_utility.table_to_json(param);
        event_center.send_event(
            mult_account_event.MULT_ACCOUNT_SWITCH_ACCOUNT_LIST_DLG, json);
    end;

    on_custom_btn_click = function (uilib, control_id, x, y)
        if plugin_tool_simple_panel.cur_game_id ~= nil and 
            frame_bottom_model.is_super_multi_account(plugin_tool_simple_panel.cur_game_id) then
            ierd_tgp.tpf_ui.Require('super_multi_account_mgr\\view.lua');
            super_multi_account_mgr_view.open(plugin_tool_simple_panel.cur_game_id);
        end
    end;

    on_cross_setting_btn_click = function (uilib, control_id, x, y)
        if WGGameAction.IsFilterGameInAccLaunchCfg(plugin_tool_simple_panel.cur_game_id) then
            WGGameAction.PopTipsForSwitchQQLogin();
            return;
        end;
        if plugin_tool_simple_panel.cur_game_id == 0 then
            base_utility.log("cur_game_id empty!", true);
            return;
        end;

        -- local rail_host = base_utility.get_component_adapter(
            -- "IRailHost", "ierd_tgp.tgp_plugin.GetRailHostAdapter();");
        --rail_host:OpenCrossConfigWnd(plugin_tool_simple_panel.cur_game_id);
        local param = {};
        param["game_id"] = plugin_tool_simple_panel.cur_game_id;
        event_center.send_event(frame_bottom_event.RAIL_PROPERTIES_BTN_CLICK_EVENT, base_utility.table_to_json(param));
    end;

    on_dlc_btn_click = function (uilib, control_id)
        rail_dlc_manager_view.show();
        local rail_host = base_utility.get_component_adapter(
            "IRailHost", "ierd_tgp.tgp_plugin.GetRailHostAdapter();");
        rail_host:OnShowDlcManager(plugin_tool_simple_panel.cur_game_id);
        plugin_tool_simple_panel.dlc_download_tips[plugin_tool_simple_panel.cur_game_id] = false;
        plugin_tool_simple_panel.show_game_download_dlc_tips(plugin_tool_simple_panel.cur_game_id, false);
    end;

    show_dlc_btn = function (is_show)
        local dlc_btn_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn");
        local dlc_btn_id2 = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn\\BtnDLCDownload");

        if 0 == dlc_btn_id then
            base_utility.log("[plugin_tool_simple_panel]show_dlc_btn dlc_btn_id 0 ");
            return;
        end

        plugin_tool_simple_panel.show_dlc_btn_flag = is_show;

        plugin_tool_simple_panel.show_game_download_dlc_tips(plugin_tool_simple_panel.cur_game_id,
            plugin_tool_simple_panel.dlc_download_tips[plugin_tool_simple_panel.cur_game_id]);
        if true == is_show then
            ui_utility.setproperty_by_id(dlc_btn_id, "Visible", "true");
            ui_utility.setproperty_by_id(dlc_btn_id2, "Visible", "true");
            base_utility.log("[plugin_tool_simple_panel]show dlc btn");
        else
            ui_utility.setproperty_by_id(dlc_btn_id, "Visible", "false");
            ui_utility.setproperty_by_id(dlc_btn_id2, "Visible", "false");
            base_utility.log("[plugin_tool_simple_panel]show_dlc_btn false ");
        end
    end;
    
    show_dlc_mgr = function()
        rail_dlc_manager_view.show();
        local rail_host = base_utility.get_component_adapter(
            "IRailHost", "ierd_tgp.tgp_plugin.GetRailHostAdapter();");
        rail_host:OnShowDlcManager(plugin_tool_simple_panel.cur_game_id);
        plugin_tool_simple_panel.dlc_download_tips[plugin_tool_simple_panel.cur_game_id] = false;
        plugin_tool_simple_panel.show_game_download_dlc_tips(plugin_tool_simple_panel.cur_game_id, false); 
    end;

    set_version_post_state = function()
        local btn_link_id = ui_utility.get_ctrl_id_by_path(
                    plugin_tool_simple_panel.parent_id, "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\btn_link");
        if btn_link_id == nil then return end
        local state_value = frame_bottom_view.get_current_game_state();
        if state_value == ierd_tgp.game_library.GAME_STATE_UPDATING or 
            state_value == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE then
            local update_post_url = frame_bottom_view.game_and_plugin_state_tbl_.game.update_post_url;
            if update_post_url ~= nil and update_post_url ~= "" then
                ui_utility.setproperty_by_id(btn_link_id, "Visible", "true");
            else
                ui_utility.setproperty_by_id(btn_link_id, "Visible", "false");
            end
        else
            ui_utility.setproperty_by_id(btn_link_id, "Visible", "false"); 
        end
    end;

    -- 点击预更新按钮
    on_pre_update_btn_click = function(uilib, control_id, x, y)
        local game_lib =
        base_utility.get_component_adapter("IGame_library",
            "ierd_tgp.game_library.Get_game_library_adapter();");
        local preupdate_info = ierd_tgp.game_library.Pre_Update_Status_Info:new();
        if game_lib ~= nil then
            game_lib:get_preupdate_status_info(plugin_tool_simple_panel.cur_game_id, preupdate_info);
        end;
        local param = { };
        param.game_id = plugin_tool_simple_panel.cur_game_id;
        param.type = "tools";
        param.sub_page = "AUTO_UPDATE";
        local json_str = base_utility.table_to_json(param);

        base_utility.log(string.format("[frame_bottom][on_pre_update_btn_click]" ..
            "send OPEN_TOOLBOX_GAME_UPDATE_PAGE, param:%s", json_str), true);
        web_utility.open_link(json_str);
        preupdate_info:delete();
        local game_state = banner_model.get_game_state(plugin_tool_simple_panel.cur_game_id);
        base_utility.log(string.format("[frame_bottom][on_pre_update_btn_click]" ..
            "game_id:%d, iPre_download:%d, formal_update_after:%d, pre_download_status:%d",
            plugin_tool_simple_panel.cur_game_id, game_state.iPre_download,
            game_state.formal_update_after, game_state.pre_download_status));

        if game_state.iPre_download == 1 and
            game_state.formal_update_after > 0 and
            game_state.pre_download_status ~= ierd_tgp.game_library.kDownloading and
            game_state.pre_download_status ~= ierd_tgp.game_library.kFinished then
            base_utility.log(string.format("[frame_bottom][on_pre_update_btn_click]start preupdate"));
            if game_lib ~= nil then
                local data_out = comm_center.call_service(
                    "i_service_allow_continue_preupdate_game",
                    {game_id = plugin_tool_simple_panel.cur_game_id});
                if data_out ~= nil and not data_out.bAllowContinue then
                    return;
                end
                game_lib:start_preupdate_game(plugin_tool_simple_panel.cur_game_id, 1);
                state_operation_panel.set_preupdate_mutex(
                    plugin_tool_simple_panel.cur_game_id, true);    
            end;
        end

        -- tqos上报
        qosparam = ierd_tgp.tpf_ui.LuaQosData:new();
        qosparam.oc_type = 1;
        qosparam.qos_report_id = 176;
        -- 按钮上报的点击qosid
        qosparam.int_count = 4;
        qosparam.str_count = 1;
        qosparam.int_val[0] = 0;
        qosparam.int_val[1] = 50;
        qosparam.int_val[2] = 1;
        qosparam.int_val[3] = plugin_tool_simple_panel.cur_game_id;
        qosparam.str_val1 = tostring(plugin_tool_simple_panel.cur_game_id);
        base_utility.lua_qos(qosparam);
        qosparam:delete();
    end;

    -- 设置预下载状态
    set_preupdate_btn_state = function()
        local game_id = plugin_tool_simple_panel.cur_game_id;
        local game_state = banner_model.get_game_state(game_id);
        if game_state == nil then
            return;
        end;
        local rail_panel_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns");
        local panel_id = ui_utility.get_ctrl_id_by_path(
            rail_panel_id, "PreUpdateCtn");
        local preupdate_btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnPreUpdate");
        local preupdate_anim_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnPreUpdateAnimation");

        if game_state.iState == ierd_tgp.game_library.GAME_STATE_UNINSTALLING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_DOWNLOAD_FAIL or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_DOWNLOADING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_UPDATING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE then
            ui_utility.setproperty_by_id(panel_id, "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_btn_id, "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_anim_id, "Visible", "false");
            return;
        end

        local has_preupdate = game_state.iPre_download;
        local pre_download_status = game_state.pre_download_status;
        local formal_update_after = game_state.formal_update_after;
     
        base_utility.log(string.format("[frame_bottom][set_preupdate], has_preupdate:%d, status:%d, formal_update_after:%d, game_id:%d",
            has_preupdate, pre_download_status, formal_update_after, game_id));

        local btn_show_state = 0;       -- "1": 显示预更新按钮，“2”：显示预更新动画，“0”：隐藏预更新按钮
        if has_preupdate == 1 and formal_update_after > 0 then
            btn_show_state = 1;
            if pre_download_status == ierd_tgp.game_library.kFinished then
                btn_show_state = 0;
            elseif pre_download_status == ierd_tgp.game_library.kWaitting or
                pre_download_status == ierd_tgp.game_library.kDownloading then
               btn_show_state = 2;
            end
        else
            btn_show_state = 0;
        end
        
        if btn_show_state == 0 then
            ui_utility.setproperty_by_id(panel_id, "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_btn_id, "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_anim_id, "Visible", "false");
        elseif btn_show_state == 1 then
            ui_utility.setproperty_by_id(panel_id, "Visible", "true");
            ui_utility.setproperty_by_id(preupdate_btn_id, "Visible", "true");
            ui_utility.setproperty_by_id(preupdate_anim_id, "Visible", "false");
            ui_utility.setproperty_by_path(rail_panel_id, "btn_link", "Visible", "false");
        elseif btn_show_state == 2 then
            ui_utility.setproperty_by_id(panel_id, "Visible", "true");
            ui_utility.setproperty_by_id(preupdate_btn_id, "Visible", "false");
            ui_utility.setproperty_by_path(rail_panel_id, "btn_link", "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_anim_id, "Visible", "true");
        end
    end;

    set_preupdate_result = function(preupdate_result)
        base_utility.log(string.format("[frame_bottom][set_preupdate_result], result:%d, game_id:%d",
            preupdate_result, plugin_tool_simple_panel.cur_game_id));
        local rail_panel_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns");
        local panel_id = ui_utility.get_ctrl_id_by_path(
            rail_panel_id, "PreUpdateCtn");
        local preupdate_btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnPreUpdate");
        local preupdate_anim_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnPreUpdateAnimation");
        if preupdate_result == 0 then
            ui_utility.setproperty_by_id(panel_id, "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_btn_id, "Visible", "false");
            ui_utility.setproperty_by_id(preupdate_anim_id, "Visible", "false");
        else
            ui_utility.setproperty_by_id(panel_id, "Visible", "true");
            ui_utility.setproperty_by_id(preupdate_btn_id, "Visible", "true");
            ui_utility.setproperty_by_id(preupdate_anim_id, "Visible", "false");
            ui_utility.setproperty_by_path(rail_panel_id, "btn_link", "Visible", "false");
        end
    end;
    
    show_game_download_dlc_tips = function(game_id, show)
    base_utility.log(string.format("[frame_bottom][show_game_download_dlc_tips], show:%s, game_id:%d, show_dlc_btn:%s, cur_game_id%d",
            tostring(show), game_id, tostring(plugin_tool_simple_panel.show_dlc_btn_flag), plugin_tool_simple_panel.cur_game_id));
        if (game_id == plugin_tool_simple_panel.cur_game_id) then
            local download_dlc_red_pot = ui_utility.get_ctrl_id_by_path(
                plugin_tool_simple_panel.parent_id,
                "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn\\BtnDLCDownload\\download_dlc_red_pot");

            if 0 == download_dlc_red_pot then
                base_utility.log("[frame_bottom][show_game_download_dlc_tips] no download_dlc_red_pot");
                return;
            end
         
            plugin_tool_simple_panel.dlc_download_tips[game_id] = show;
            
            local dlc_download_tips_id = ui_utility.get_ctrl_id_by_path(
                    plugin_tool_simple_panel.parent_id,
                    "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn\\dlchoverBtnBig");
                    
           if 0 == dlc_download_tips_id then
                base_utility.log("[frame_bottom][show_game_download_dlc_tips] no dlc_download_tips_id");
                return;
            end
            
            if true == plugin_tool_simple_panel.show_dlc_btn_flag then
                if true == show then
                    ui_utility.setproperty_by_id(download_dlc_red_pot, "Visible", "true");
                    base_utility.log("[show_game_download_dlc_tips]show DlcDownloadTips");
                else
                    ui_utility.setproperty_by_id(download_dlc_red_pot, "Visible", "false");
                    ui_utility.setproperty_by_id(dlc_download_tips_id, "Visible", "false");
                end
            else 
                ui_utility.setproperty_by_id(download_dlc_red_pot, "Visible", "false");
                ui_utility.setproperty_by_id(dlc_download_tips_id, "Visible", "false");
            end
        end
    end;
    
    on_frame_size_changed = function()
        local parent_ctrl_ptr = ui_utility.get_ctrl_ptr_by_id(plugin_tool_simple_panel.parent_id);
        if nil == parent_ctrl_ptr then
            return;
        end
        local ancestor_ctrl_ptr = parent_ctrl_ptr:GetParent();
        if nil == ancestor_ctrl_ptr then
            return;
        end
        
        local state_operation_cnt_ctrl_id = ui_utility.get_ctrl_id_by_path(ancestor_ctrl_ptr:GetControlID(), "Bottom_Status_Operate_Area\\StateOperationCnt\\error_prompt_cnt");
        if nil == state_operation_cnt_ctrl_id then
             base_utility.log("[frame_bottom][on_frame_size_changed] state_operation_cnt_ctrl_id null");
            return;
        end
        
        local state_operation_cnt_ctrl_ptr = ui_utility.get_ctrl_ptr_by_id(state_operation_cnt_ctrl_id);
        if nil == state_operation_cnt_ctrl_ptr then
        base_utility.log("[frame_bottom][on_frame_size_changed] state_operation_cnt_ctrl_ptr null");
            return;
        end
        
        local updating_or_downing_cnt_id = ui_utility.get_ctrl_id_by_path(ancestor_ctrl_ptr:GetControlID(), "Bottom_Status_Operate_Area\\UpdatingOrDowningCnt");
        if nil == updating_or_downing_cnt_id then
            base_utility.log("[frame_bottom][on_frame_size_changed] updating_or_downing_cnt_id null");
            return;
        end
        
        local updating_or_downing_cnt_ctrl_ptr = ui_utility.get_ctrl_ptr_by_id(updating_or_downing_cnt_id);
        if nil == updating_or_downing_cnt_ctrl_ptr then
            base_utility.log("[frame_bottom][on_frame_size_changed] updating_or_downing_cnt_ctrl_ptr null");
            return;
        end
        
         base_utility.log(string.format("[frame_bottom][on_frame_size_changed] updating_or_downing_cnt_ctrl_ptr:%d, state_operation_cnt_ctrl_ptr:%d",
         updating_or_downing_cnt_ctrl_ptr:IsVisible() , state_operation_cnt_ctrl_ptr:IsVisible()));
        
        if FALSE ==  updating_or_downing_cnt_ctrl_ptr:IsVisible() and
            FALSE == state_operation_cnt_ctrl_ptr:IsVisible() then
            base_utility.log("[frame_bottom][on_frame_size_changed] all unvisible");
            return;
        end
        
    end;
    
    on_mainframe_position_change = function()
        plugin_tool_simple_panel.on_frame_size_changed();
    end;
    
    on_mainframe_size_change = function()
        plugin_tool_simple_panel.on_frame_size_changed();
    end;
    
    on_right_btn_game_click = function()
        plugin_tool_simple_panel.on_frame_size_changed();
    end;
    
    set_cloud_game_btn_state = function()
        local game_id = plugin_tool_simple_panel.cur_game_id;
        local game_state = banner_model.get_game_state(game_id);
        if game_state == nil then
            return;
        end;
    end;

    on_cloud_game_btn_hover = function(uilib, control_id)
        local id = control_id;
        --获取oss配置的tips内容
        local tips_content_text = plugin_tool_simple_panel.cloud_game_btn_tips_text;

        if tips_content_text ~= nil and tips_content_text ~= "" then
            local panel_id = ui_utility.get_ctrl_id_by_path(
                plugin_tool_simple_panel.parent_id,
                "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn");
            local btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnCloudGame");
            local tip_dlg_id = ui_utility.get_ctrl_id_by_path(panel_id, "hoverBtnBig");
            local tip_text_id = ui_utility.get_ctrl_id_by_path(tip_dlg_id, "CloudGameTipsText");
            local content_str,path_hoder = U8toCUIStr(tips_content_text);
            ui_utility.setproperty_by_id(tip_text_id, "Caption", tips_content_text);
            ui_utility.setproperty_by_id(tip_text_id, "Visible", "true");
            ui_utility.setproperty_by_id(tip_dlg_id, "Visible", "true");
        end;
    end;

    on_cloud_game_btn_leave = function(uilib, control_id)
        local id = control_id;
        local panel_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn");
        local btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnCloudGame");
        local tip_dlg_id = ui_utility.get_ctrl_id_by_path(panel_id, "hoverBtnBig");
        local tip_text_id = ui_utility.get_ctrl_id_by_path(tip_dlg_id, "CloudGameTipsText");
        ui_utility.setproperty_by_id(tip_text_id, "Visible", "false");
        ui_utility.setproperty_by_id(tip_dlg_id, "Visible", "false");
    end;


    on_cloud_game_pro_hover = function(uilib, control_id)
        local id = control_id;
        local tips_content_text = plugin_tool_simple_panel.cloud_game_maintenance_tips;

        if tips_content_text ~= nil and tips_content_text ~= "" then
            local panel_id = ui_utility.get_ctrl_id_by_path(
                plugin_tool_simple_panel.parent_id,
                "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn");
            local btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnCloudGame");
            local tip_dlg_id = ui_utility.get_ctrl_id_by_path(panel_id, "hoverBtnBig");
            local tip_text_id = ui_utility.get_ctrl_id_by_path(tip_dlg_id, "CloudGameTipsText");
            local content_str,path_hoder = U8toCUIStr(tips_content_text);
            ui_utility.setproperty_by_id(tip_text_id, "Caption", tips_content_text);
            ui_utility.setproperty_by_id(tip_text_id, "Visible", "true");
            ui_utility.setproperty_by_id(tip_dlg_id, "Visible", "true");
        end;
    end;

    on_cloud_game_pro_leave = function(uilib, control_id)
        local id = control_id;
        local panel_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn");
        local btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnCloudGame");
        local tip_dlg_id = ui_utility.get_ctrl_id_by_path(panel_id, "hoverBtnBig");
        local tip_text_id = ui_utility.get_ctrl_id_by_path(tip_dlg_id, "CloudGameTipsText");
        ui_utility.setproperty_by_id(tip_text_id, "Visible", "false");
        ui_utility.setproperty_by_id(tip_dlg_id, "Visible", "false");
    end;

    cloud_game_btn_tips_hide = function(uilib, control_id)
        base_utility.log("cloud_game_btn_tips_hide");
    end;

    change_cloud_game_btn_display_state = function()
        -- 刷新云游戏状态
    end;

    get_cloud_game_state = function()
        
    end;

    on_cloud_game_btn_click = function (uilib, control_id)
        base_utility.log("on_cloud_game_btn_click", true);
        local param = {game_id = plugin_tool_simple_panel.cur_game_id};
        comm_center.call_service("SvrLua_CloudGame_Launch_Request", param);
    end;

    show_cloud_game_btn = function(param)
        base_utility.log("show_cloud_game_btn", true);
        if param == nil or param.game_id == nil or param.game_id == 0 then
            base_utility.log("param error", true);
            return
        end
        if param.game_id ~= plugin_tool_simple_panel.cur_game_id then
            base_utility.log("game not match", true);
            return;
        end

        if param.no_data == nil or param.no_data == true then
            local refresh_param = {game_id = tonumber(param.game_id)};
            comm_center.call_service("SvrLua_FrameBottom_RefreshGameState", refresh_param);
            base_utility.log("cloud cfg_str is empty", true);
            return;
        end

        local cfg_str = param.cloud_game_cfg_str;
        local cfg_tbl = base_utility.json_to_table(cfg_str);
        plugin_tool_simple_panel.cloud_game_btn_tips_text = "";
        --plugin_tool_simple_panel.cloud_game_btn_tips_text = cfg_tbl.launch_btn_hover_tips;
        if param.maintenance_tips ~= nil then
            base_utility.log("get cloud maintenance tips:"..param.maintenance_tips, true);
            local tips = param.maintenance_tips;
            if base_utility.string_end_with(tips, "<br>") then
                local len = string.len(tips);
                tips = string.sub(tips, 1, len - 4);
            end;
            plugin_tool_simple_panel.cloud_game_maintenance_tips = tips;
        else
            base_utility.log("cloud maintenance empty", true);
            plugin_tool_simple_panel.cloud_game_maintenance_tips = "";
        end;
        plugin_tool_simple_panel.cloud_gaming_server_closed = false;
        if not param.cloud_provider_working  and not param.server_ready then
            local param = {};
            param.game_id = plugin_tool_simple_panel.cur_game_id;
            param.state = CloudGameState.kCloudGameStateServerUnavailable;
            param.progress = 0;
            param.cloud_channel_id = 0;
            comm_center.send_broadcast("Svr_CloudGameState", param);
            plugin_tool_simple_panel.cloud_gaming_server_closed = true;
            return;
        end;

        --主动获取状态决定显示按钮或进度  must be changed to cloud_channel_id
        local game_id = plugin_tool_simple_panel.cur_game_id;
        comm_center.call_service(
                'Svr_PrepareCloudGame', {game_id = game_id});
    end;

    change_cloud_game_state = function(param)
        if plugin_tool_simple_panel.cloud_gaming_server_closed then
            --平台查询到维护，不再响应rail启动状态广播
            base_utility.log("change_cloud_game_state, server closed");
            return;
        end;
        if param == nil or param.game_id == nil or param.state == nil  then
            base_utility.log("change_cloud_game_state, param error", true);
            return;
        end;
        if tonumber(param.game_id) ~= plugin_tool_simple_panel.cur_game_id then
            base_utility.log("change_cloud_game_state, not current game", true);
            return;
        end;

        
        local is_cloud_game_tmp = 0;
        local get_cloud_game_cfg_param = {game_id = param.game_id};
        local cloud_game_cfg = comm_center.call_service("i_service_get_cloud_game_cfg_info",
                                get_cloud_game_cfg_param);
        if cloud_game_cfg ~= nil and cloud_game_cfg.get_data ~=nil and
            cloud_game_cfg.get_data == true then
                is_cloud_game_tmp = 1;
        end;

        base_utility.log("change_cloud_game_state=" .. param.state 
                .. ", progress=" .. param.progress
                .. ", cloud_channel_id=" .. param.cloud_channel_id
                .. ", game=" .. param.game_id
                ..",is_cloud_game_tmp" ..is_cloud_game_tmp, true);

        local panel_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn");
        local btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnCloudGame");
        local progress_id = ui_utility.get_ctrl_id_by_path(panel_id, "CloudGameProgress");

        --ui_utility.setproperty_by_id(panel_id, "Visible", "true");
        
        local cur_state = param.state;
        local show_text = "";
        local can_start = false;
        if cur_state == CloudGameState.kCloudGameStateReady 
            or cur_state == CloudGameState.kCloudGameStateNeedUpdate 
            or cur_state == CloudGameState.kCloudGameStateUpdateFailed
            or cur_state == CloudGameState.kCloudGameStateLaunchFailed then
            plugin_tool_simple_panel.cloud_game_is_running = false;
            can_start = true;
        elseif cur_state == CloudGameState.kCloudGameStateServerUnavailable then
            plugin_tool_simple_panel.cloud_game_is_running = false;

            if plugin_tool_simple_panel.cloud_game_maintenance_tips ~= nil and
               plugin_tool_simple_panel.cloud_game_maintenance_tips ~= "" then
               base_utility.log(
                "in maintenance status,tips:"..plugin_tool_simple_panel.cloud_game_maintenance_tips, true);
            else
                base_utility.log("in maintenance status,tips empty", true);
            end;
        else
            plugin_tool_simple_panel.cloud_game_is_running = true;
            if cur_state == CloudGameState.kCloudGameStateUpdating then
                if param.progress <= 0 then
                    show_text = LoadStr("FRAME_BOTTOM_CLOUD_GAME_CHECKING");
                else
                    show_text = LoadStr("FRAME_BOTTOM_CLOUD_GAME_DOWNLOADING");
                    show_text = show_text .. param.progress .. "%";
                end;
            elseif cur_state == CloudGameState.kCloudGameStateLaunching then
                show_text = LoadStr("FRAME_BOTTOM_CLOUD_GAME_LAUNCHING");
            elseif cur_state == CloudGameState.kCloudGameStateRunning then
                show_text = LoadStr("FRAME_BOTTOM_CLOUD_GAME_RUNNING");
            end;
        end;
        --  更新启动按钮状态
        local game_id_type = type(param.game_id);
        local game_id_number = param.game_id;
        if game_id_type == "string" then
            game_id_number = tonumber(param.game_id);
        end;
        local refresh_param = {game_id = game_id_number};
        comm_center.call_service("SvrLua_FrameBottom_RefreshGameState", refresh_param);
        plugin_tool_simple_panel.set_cloud_game_entry_status(true, can_start, show_text);
    end;

    get_cloud_game_running_state = function(param)
        return plugin_tool_simple_panel.cloud_game_is_running;
    end;

    
    on_dlc_btn_hover = function(uilib, control_id)
        local id = control_id;
        if plugin_tool_simple_panel.cur_game_id == 0 then
            return;
        end;
        local dlc_download_tips_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn\\dlchoverBtnBig");
        local tip_text_id = ui_utility.get_ctrl_id_by_path(dlc_download_tips_id, "DlcDownloadTips");
        local is_show = plugin_tool_simple_panel.dlc_download_tips[plugin_tool_simple_panel.cur_game_id];
        if is_show and dlc_download_tips_id ~= nil  and tip_text_id ~= nil then
            ui_utility.setproperty_by_id(tip_text_id, "Caption", LoadStr("GAME_HAS_UNINSTALLED_DLC"));
            ui_utility.setproperty_by_id(dlc_download_tips_id, "Visible", "true");            
        end;
    end;
    
    on_dlc_btn_leave = function(uilib, control_id)
        local id = control_id;
        local dlc_download_tips_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn\\dlchoverBtnBig");
        if dlc_download_tips_id ~= nil then
            ui_utility.setproperty_by_id(dlc_download_tips_id, "Visible", "false");
        end;
    end;

    set_attach_game_entry_state = function(game_id)
        local rail_panel_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns");
        if rail_panel_id == nil or rail_panel_id == Tenio.INVALID_CONTROLID then
            return;
        end

        local ctn_id = ui_utility.get_ctrl_id_by_path(rail_panel_id, "BtnAttachGameEntryCtn");
        if ctn_id == nil or ctn_id == Tenio.INVALID_CONTROLID then
            return;
        end

        local entry_id = ui_utility.get_ctrl_id_by_path(ctn_id, "BtnAttachGameEntry");
        if entry_id == nil or entry_id == Tenio.INVALID_CONTROLID then
            return;
        end

        if game_id == nil or tonumber(game_id) == nil or tonumber(game_id) == 0 then
            ui_utility.setproperty_by_id(ctn_id, "Visible", "false");
        end

        local attach_info = comm_center.call_service("Svr_CheckHasAttachRel", 
                {game_id = tonumber(game_id), has_attach = 0, select_id = 0, main_game_id = 0});
        if attach_info == nil or attach_info.has_attach ~= 1 or attach_info.main_game_id == 0 then
            ui_utility.setproperty_by_id(ctn_id, "Visible", "false");
            return;
        end;

        local entry_info = comm_center.call_service("Svr_GetAttachGameEntryInfo", 
                {game_id = tonumber(game_id), entry_show = 0, entry_title = "", entry_link = ""});
        
        if entry_info == nil or entry_info.entry_show == 0 or entry_info.entry_title == "" then
            ui_utility.setproperty_by_id(ctn_id, "Visible", "false");
            return;
        end

        --[[local is_need_cut = ui_utility.is_over_char_count(entry_info.entry_title, 4);
        local caption = entry_info.entry_title;
        if true == is_need_cut then
            local tem = U8toCUIStrn(entry_info.entry_title, 3, 1);
            caption = CUIStrtoU8(tem);
        end--]]
        ui_utility.setproperty_by_id(entry_id, "Caption", entry_info.entry_title);
        ui_utility.setproperty_by_id(ctn_id, "Visible", "true");
    end;

    on_attach_game_entry_click = function (uilib, control_id, x, y)
        if plugin_tool_simple_panel.cur_game_id == 0 or 
           plugin_tool_simple_panel.cur_game_id == nil then
            base_utility.log("on_attach_game_entry_click, cur_game_id empty!");
            return;
        end
        local game_id = tonumber(plugin_tool_simple_panel.cur_game_id);
        local entry_info = comm_center.call_service("Svr_GetAttachGameEntryInfo", 
                {game_id = game_id, entry_show = 0, entry_title = "", switch_id = 0});
        
        if entry_info == nil or entry_info.entry_show == 0 or 
           entry_info.entry_link == nil or entry_info.entry_link == "" then
            base_utility.log("on_attach_game_entry_click, entry_info not complete");
            return;
        end
        web_utility.open_link(entry_info.entry_link);
    end;

    on_download_extension_btn_click = function(uilib, control_id, x, y)
        local game_id = tonumber(plugin_tool_simple_panel.cur_game_id);
        local result = comm_center.call_service("Svr_GameLibrary_GetDownloadExtensionCfg",
                {game_id = game_id, need_show_btn = false, need_show_tips = false, cfg = ""});
        local need_show_tips = false;
        if result ~= nil then
            need_show_tips = result.need_show_tips;
        end

        if need_show_tips then
            local cfg = base_utility.json_to_table(result.cfg);
            base_utility.log(string.format("[frame_bottom]on_download_extension_btn_click, need show tips, tips_msg:%s, game_id:%u",
                cfg.tips_msg, game_id));
            comm_center.call_service("Svr_GameLibrary_MarkDownloadExtensionTipsShown",
                {game_id = game_id});
            local param = {
                position = "center",
                title = LoadStr("POP_WND_COMMON_TITLE"),
                width = 480,
                height = 230,
                titleIcon = "",
                icon = "",
                tipsIcon = poptips_icons.kInfo,
                descTitle = cfg.tips_msg,
                desc = "",
                okBtn = {
                    visible = "true",
                    text = LoadStr("POP_WND_COMMON_OK"),
                    handle = function()
                        comm_center.call_service("Svr_GameLibrary_DownloadExtensionPackage",
                                {game_id = game_id});
                        poptips_control.close_tips();
                    end
                },
                cancelBtn = {
                    visible = "true",
                    text = LoadStr("POP_WND_COMMON_CANCEL"),
                },
            };
            ui_utility.show_tips(param);
        else
            base_utility.log(string.format("[frame_bottom]on_download_extension_btn_click, don't show tips, game_id:%u",
                game_id));
            comm_center.call_service("Svr_GameLibrary_DownloadExtensionPackage",
                {game_id = game_id});
        end
    end;

    set_download_extension_btn_state = function()
        local game_id = tonumber(plugin_tool_simple_panel.cur_game_id);
        local panel_id = ui_utility.get_ctrl_id_by_path(
                plugin_tool_simple_panel.parent_id, "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns");
        local btn_id = ui_utility.get_ctrl_id_by_path(panel_id, "BtnDownloadExtension");
        local result = comm_center.call_service("Svr_GameLibrary_GetDownloadExtensionCfg",
                {game_id = game_id, need_show_btn = false, need_show_tips = false, cfg = ""});
        if result == nil or result.need_show_btn == false then
            ui_utility.setproperty_by_id(btn_id, "Visible", "false");
            return;
        end

        local game_state = banner_model.get_game_state(game_id);
        if game_state == nil then
            ui_utility.setproperty_by_id(btn_id, "Visible", "false");
            return;
        end;
        plugin_tool_simple_panel.cur_game_state = game_state.iState;

        if game_state.iState == ierd_tgp.game_library.GAME_STATE_UNINSTALLING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_DOWNLOADING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_DOWNLOAD_FAIL or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_UPDATING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_UPDATE_PAUSED or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_UPDATE_FAIL or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_REPAIRING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_INSTALLING or
           game_state.iState == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE then
            ui_utility.setproperty_by_id(btn_id, "Disable", "true");
        else
            ui_utility.setproperty_by_id(btn_id, "Disable", "false");
        end

        local cfg = base_utility.json_to_table(result.cfg);
        ui_utility.setproperty_by_id(btn_id, "Caption", cfg.download_extension_btn_text);
        ui_utility.setproperty_by_id(btn_id, "Visible", "true");
    end;

    on_game_state_update = function(game_state)
        if game_state == nil then
            return;
        end

        local game_id = game_state.game_id;
        if plugin_tool_simple_panel.cur_game_id ~= game_id then
            return;
        end
        base_utility.log("[frame_bottom]on_game_state_update, game_id="..game_id..",state="..game_state.status);
        plugin_tool_simple_panel.cur_game_state = game_state.status;
        if game_state.extension_game_state ~= nil then
            plugin_tool_simple_panel.set_download_extension_btn_state();
        end

        if game_state.status == ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED then
            plugin_tool_simple_panel.show_dlc_btn(false);
        end
    end;

    on_color_mode_update = function(data)
        if nil == data or nil == data.color_mode then
            return;
        end
        base_utility.log("[frame_bottom]simple panelon_color_mode_update: "
        .. tostring(data.color_mode), true);
        local color_mode = data.color_mode;
        plugin_tool_simple_panel.color_mode_ = color_mode;
        -- TODO(planezhang): change tpf style
        local rail_panel_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns");
        if rail_panel_id == nil then
            return;
        end;

        local sText = "Common.xml/BottomBarButton/NormalBtnStyle";
        if color_mode == MainCommon.color_mode.kLight then
            sText = "Common.xml/BottomBarButton/NormalBtnLightStyle";
        end;

        local btn_cross_setting = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\BtnCrossSetting");
        if btn_cross_setting ~= nil then
            ui_utility.setproperty_by_id(btn_cross_setting, "StylePath", sText);
        end;

        local entry_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\BtnAttachGameEntryCtn\\BtnAttachGameEntry");
        if entry_id ~= nil then
            ui_utility.setproperty_by_id(entry_id, "StylePath", sText);
        end;

        local dlc_btn_id = ui_utility.get_ctrl_id_by_path(
            plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\DlcDownloadBtn\\BtnDLCDownload");
        if dlc_btn_id ~= nil then
            ui_utility.setproperty_by_id(dlc_btn_id, "StylePath", sText);
        end;

        local preupdate_btn_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\PreUpdateCtn\\BtnPreUpdate");

        if preupdate_btn_id ~= nil then
            ui_utility.setproperty_by_id(preupdate_btn_id, "StylePath", sText);
        end;

        local extension_btn_id = ui_utility.get_ctrl_id_by_path(plugin_tool_simple_panel.parent_id,
            "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\BtnDownloadExtension");
        ui_utility.setproperty_by_id(extension_btn_id, "StylePath", sText);

        sText = "Common.xml/BottomBarButton/BigHighLightBtnStyle";
        if color_mode == MainCommon.color_mode.kLight then
            sText = "Common.xml/BottomBarButton/BigHighLightBtnLightStyle";
            ui_utility.setproperty_by_path(rail_panel_id, "PreUpdateCtn\\BtnPreUpdateAnimation",
            "Background", "ONEIMAGE:bottom_bar\\light_mode\\download.tfc;Stretch;0");
        else
            ui_utility.setproperty_by_path(rail_panel_id, "PreUpdateCtn\\BtnPreUpdateAnimation",
            "Background", "ONEIMAGE:bottom_bar\\download.tfc;Stretch;0");
        end;

        local btn_cloud_game_id = ui_utility.get_ctrl_id_by_path(
                plugin_tool_simple_panel.parent_id,
                "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn\\BtnCloudGame");
        if btn_cloud_game_id~= nil then
            ui_utility.setproperty_by_id(btn_cloud_game_id, "StylePath", sText);
        end;

        sText = "Common.xml/BottomBarButton/GrayBtnStyle";
        if color_mode == MainCommon.color_mode.kLight then
            sText = "Common.xml/BottomBarButton/GrayBtnLightStyle";
        end;
        local cloud_game_progress = ui_utility.get_ctrl_id_by_path(
                plugin_tool_simple_panel.parent_id,
                "PluginToolSimplePanelCtn\\StandAloneGameCtn\\CtnMixBtns\\CloudGameCtn\\CloudGameProgress");
        if cloud_game_progress~= nil then
            ui_utility.setproperty_by_id(cloud_game_progress, "StylePath", sText);
        end;
    end;
};